package com.ym521.emojipack.keyboard.adapter.viewHolder;

import android.view.View;

import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;

import com.ym521.emojipack.R;
import com.ym521.emojipack.emoji.EmojiPack;
import com.ym521.emojipack.keyboard.EmoiiPackClickListener;
import com.ym521.emojipack.widget.EmojiPackTextView;

/**
 * @author Ym
 * E-mail: 2435970206@qq.com
 * createTime:2023/9/24
 * explain:
 */
public class EmojiPackItemViewHolder extends RecyclerView.ViewHolder {
    private EmojiPackTextView icon;

    public EmojiPackItemViewHolder(@NonNull View itemView) {
        super(itemView);
        icon = itemView.findViewById(R.id.tv_emojiPack);
    }

    public void showView(EmojiPack itemData, boolean mUseSystemDefault, EmoiiPackClickListener listener){
        icon.setUseSystemDefault(mUseSystemDefault);
        icon.setText(itemData.getEmoji());
        icon.setOnClickListener(v->{
            if (listener != null) {
                listener.onEmojiClicked(itemData);
            }
        });
    }
}
